/**
 * 
 */
package view.impl.ingame;

import java.util.LinkedList;
import java.util.List;

import view.impl.ingame.animation.Effect;




/**
 * @author Julian
 *
 */
public class EffectDispatch {
	static private EffectDispatch INSTANCE = new EffectDispatch();
	
	private List<Effect> effects = new LinkedList<Effect>();
	
	public static EffectDispatch getInstance() {
		return INSTANCE;
	}
	
	private EffectDispatch() {
		
	}
	
	
	public void addEffect(Effect e) {
		effects.add(e);
	}
	
	public void draw(int delta, Fighter player1, Fighter player2) {
		List<Effect> removeEffects = new LinkedList<Effect>();
		for(Effect e : effects) {
			e.draw(delta, player1, player2);
			if(e.isDead()) {
				removeEffects.add(e);
			}
		}
		
		for(Effect e : removeEffects) {
			effects.remove(e);
		}
	}
}
